import {lazy} from "react" // 路由懒加载的
import {Navigate} from "react-router-dom" //Navigate是重定向标签，相当于5版本的Redirect
const My = lazy(()=>import("../pages/my"))
const Home = lazy(()=>import("../pages/home"))
const Video = lazy(()=>import("../pages/video"))
const Movie =lazy(()=>import("../pages/movie"))
const Show = lazy(()=>import("../pages/show"))
const Detail = lazy(()=>import("../pages/detail"))
const Classfily = lazy(()=>import("../pages/classfily"))
const routerConfig = [   // 必须叫path属性和element属性
    {
        path:"/",
        element: <Navigate to="/home"/>
    },
    {
        path:"/home",
        element:<Home></Home>,
        children:[
            {
                path:"/home",
                element:<Navigate to='/home/movie'/>
            },
            {
                path:"/home/movie",
                element:<Movie></Movie>
            },
            {
                path:"/home/show",
                element:<Show></Show>
            },
            {
                path:"/home/video",
                element:<Video></Video>
            }
        ]
    },
    {
        path:"/my",
        element:<My></My>
    },
    {
        path:"/detail/:id",
        element:<Detail></Detail>
    },
    {
        path:"/classfily",
        element:<Classfily></Classfily>
    }
]
export default routerConfig